package com.googlecode.imanager.jasper.print;

import net.sf.jasperreports.engine.JRDefaultStyleProvider;
import net.sf.jasperreports.engine.base.JRBasePrintText;

import com.googlecode.imanager.jasper.RControl;

/**
 * @author wellsantos@wellsantos.com
 * @since 0.01
 */
public class RText extends JRBasePrintText implements RChild {

    private static final long serialVersionUID = 1L;

    protected Object fieldValue;    
    protected RControl rOwner;
    protected boolean visible;

    public RText(RControl owner) {
        this(owner, null);
    }

    public RText(RControl owner, JRDefaultStyleProvider defaultStyleProvider) {
        super(defaultStyleProvider);
        this.rOwner = owner;
    }

    public void setDefaultStyleProvider(JRDefaultStyleProvider defaultStyleProvider){
        super.defaultStyleProvider = defaultStyleProvider;
    }
    
    public RControl getROwner() {
        return rOwner;
    }

    public void setROwner(RControl owner) {
        this.rOwner = owner;
    }

    @Override
    public RInsets getRInsets() {
        return RInsets.EMPTY_INSETS;
    }

    @Override
    public void setRInsets(RInsets insets) {
        // nothing to do
    }
    
    public Object getFieldValue() {
        return fieldValue;
    }

    public void setFieldValue(Object fieldValue) {
        this.fieldValue = fieldValue;
    }

    @Override
    public void destroy() {
        fieldValue = null;
        rOwner = null;
    }

    public boolean isVisible() {
        return visible;
    }

    public void setVisible(boolean visible) {
        this.visible = visible;
    }

}
